package RepaymentPlan;

/**
 * @author yunfei.shang
 * @title
 * @date 2018/10/30 19:22
 * @descreption
 */
public class BuildManySql {
    public static void main(String[] args) {
        String sql = "DROP TABLE IF EXISTS project_overdue_daily_%03d; \n" +
                "CREATE TABLE project_overdue_daily_%03d (\n" +
                "  id                  BIGINT(20)     NOT NULL  DEFAULT 0 COMMENT '主键',\n" +
                "  ProjectId           INT(11)        NOT NULL  DEFAULT 0 COMMENT '项目ID',\n" +
                "  DealDate            DATE           NOT NULL  DEFAULT '1900-01-01' COMMENT '处理日期',\n" +
                "  UnpayPrincipal      DECIMAL(20, 8) NOT NULL  DEFAULT 0.00 COMMENT '未还本金',\n" +
                "  UnpayInterest       DECIMAL(20, 8) NOT NULL  DEFAULT 0.00 COMMENT '未还利息',\n" +
                "  UnpayFeeAmount      DECIMAL(20, 8) NOT NULL  DEFAULT 0.00 COMMENT '未还费用',\n" +
                "  OverdueFeeRate      DECIMAL(10, 8) NOT NULL  DEFAULT 0.00 COMMENT '逾期费率',\n" +
                "  OverdueDailyType    SMALLINT(6)    NOT NULL  DEFAULT 0 COMMENT '逾期费用类型',\n" +
                "  OverdueFeeCfgID     INT(11)        NOT NULL  DEFAULT 0 COMMENT '逾期费用配置ID',\n" +
                "  Amount              DECIMAL(20, 8) NOT NULL  DEFAULT 0.00 COMMENT '逾期费用金额',\n" +
                "  Status              TINYINT(2)     NOT NULL  DEFAULT 0 COMMENT '状态',\n" +
                "  SystemCode          INT(11)        NOT NULL  DEFAULT 0 COMMENT '系统代码',\n" +
                "  ToFeeUserType       INT(11)        NOT NULL  DEFAULT 0 COMMENT '费用收取方类型',\n" +
                "  Version             VARCHAR(100)   NOT NULL  DEFAULT '' COMMENT '版本',\n" +
                "  RelatedBusinessDate DATE           NOT NULL  DEFAULT '1900-01-01' COMMENT '关联日期日期',\n" +
                "  CalStartDate        DATE           NOT NULL  DEFAULT '1900-01-01' COMMENT '计算起始日期',\n" +
                "  CalRealStartDate    DATE           NOT NULL  DEFAULT '1900-01-01' COMMENT '实际计算起始日期',\n" +
                "  CalEndDate          DATE           NOT NULL  DEFAULT '1900-01-01' COMMENT '计算结束日期',\n" +
                "  CreateBy            INT(11)        NOT NULL  DEFAULT 0 COMMENT '创建人',\n" +
                "  CreateAt            DATETIME       NOT NULL  DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',\n" +
                "  UpdateBy            INT(11)        NOT NULL  DEFAULT 0 COMMENT '修改人',\n" +
                "  UpdateAt            DATETIME       NOT NULL  DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',\n" +
                "  PRIMARY KEY (id),\n" +
                "  INDEX idx_prd(ProjectId),\n" +
                "  INDEX idx_tp_st(OverdueDailyType, Status),\n" +
                "  INDEX idx_d_v(DealDate, Version)\n" +
                ") ENGINE = InnoDB DEFAULT CHARSET = utf8 COMMENT = '项目每日逾期费用';";
        for (int i = 0; i < 128; i++) {
            System.out.println(String.format(sql, i, i));
        }
    }
}
